using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace VOL.Entity.DomainModels
{
    /// <summary>
    /// 销售订单和明细组合创建DTO，用于创建时不包含系统自动生成的字段
    /// </summary>
    public class ShopOrderWithDetailsCreateDto
    {
        /// <summary>
        /// 销售订单创建DTO
        /// </summary>
        [Required(ErrorMessage = "销售订单信息不能为空")]
        public ShopOrderCreateDto ShopOrder { get; set; }

        /// <summary>
        /// 销售订单明细创建DTO列表
        /// </summary>
        [Required(ErrorMessage = "销售订单明细不能为空")]
        [MinLength(1, ErrorMessage = "至少需要一条销售订单明细")]
        public List<ShopOrderDetailCreateDto> ShopOrderDetails { get; set; }
    }

    /// <summary>
    /// 销售订单创建DTO，不包含系统自动生成的字段
    /// </summary>
    public class ShopOrderCreateDto
    {
        /// <summary>
        /// 销售单号
        /// </summary>
        [Required(ErrorMessage = "销售单号不能为空")]
        [MaxLength(50, ErrorMessage = "销售单号长度不能超过50个字符")]
        public string ShopOrderCode { get; set; }

        /// <summary>
        /// 销售日期
        /// </summary>
        [Required(ErrorMessage = "销售日期不能为空")]
        public DateTime ShopOrderDate { get; set; }

        /// <summary>
        /// 客户Id
        /// </summary>
        [Required(ErrorMessage = "客户不能为空")]
        public long CustomerId { get; set; }

        /// <summary>
        /// 联系人
        /// </summary>
        [MaxLength(30, ErrorMessage = "联系人长度不能超过30个字符")]
        public string Contact { get; set; }

        /// <summary>
        /// 联系方式
        /// </summary>
        [MaxLength(20, ErrorMessage = "联系方式长度不能超过20个字符")]
        public string ContactPhone { get; set; }

        /// <summary>
        /// 部门Id
        /// </summary>
        [Required(ErrorMessage = "部门不能为空")]
        [MaxLength(50, ErrorMessage = "部门ID长度不能超过50个字符")]
        public string DeptId { get; set; }

        /// <summary>
        /// 用户Id
        /// </summary>
        [Required(ErrorMessage = "用户不能为空")]
        public long UserId { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public int? Status { get; set; }

        /// <summary>
        /// 审核人
        /// </summary>
        [MaxLength(30, ErrorMessage = "审核人长度不能超过30个字符")]
        public string AuditUser { get; set; }

        /// <summary>
        /// 审核时间
        /// </summary>
        public DateTime? AuditTime { get; set; }

        /// <summary>
        /// 销售总货品
        /// </summary>
        [MaxLength(100, ErrorMessage = "销售总货品长度不能超过100个字符")]
        public string ShopAllGoods { get; set; }

        /// <summary>
        /// 销售总数量
        /// </summary>
        public int? ShopAllNum { get; set; }

        /// <summary>
        /// 销售总金额
        /// </summary>
        public long? ShopAllMoney { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(100, ErrorMessage = "备注长度不能超过100个字符")]
        public string Remark { get; set; }
    }

    /// <summary>
    /// 销售订单明细创建DTO，不包含系统自动生成的字段
    /// </summary>
    public class ShopOrderDetailCreateDto
    {
        /// <summary>
        /// 货品外键Id
        /// </summary>
        [Required(ErrorMessage = "货品不能为空")]
        public long GoodsId { get; set; }

        /// <summary>
        /// 销售货品数量
        /// </summary>
        [Required(ErrorMessage = "销售数量不能为空")]
        [Range(1, int.MaxValue, ErrorMessage = "销售数量必须大于0")]
        public int ShopOrderNum { get; set; }

        /// <summary>
        /// 销售货品单价
        /// </summary>
        [Required(ErrorMessage = "销售单价不能为空")]
        [Range(0, long.MaxValue, ErrorMessage = "销售单价不能为负数")]
        public long ShopOrderMoney { get; set; }

        /// <summary>
        /// 销售货品总金额
        /// </summary>
        [Required(ErrorMessage = "销售总金额不能为空")]
        [Range(0, long.MaxValue, ErrorMessage = "销售总金额不能为负数")]
        public long ShopOrderAllMoney { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(100, ErrorMessage = "备注长度不能超过100个字符")]
        public string Remark { get; set; }
    }
}
